import request from '@/utils/request';
// import { request } from 'umi';
import umiRequest from 'umi-request';

// /api/v1/patient/create添加患者信息
export async function addCreatePatient(data: any, options?: any): Promise<any> {
  return request('/api/v1/patient/create', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// /api/v1/patient/update患者信息修改
export async function addUpdatePatient(data: any, options?: any): Promise<any> {
  return request('/api/v1/patient/update', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


// /api/v1/patient/get/{id}患者信息详情
export async function getPatientDetail(data: any, options?: any): Promise<any> {
  return request(`/api/v1/patient/get/${data?.id}`, {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// /api/v1/organize/list组织列表
export async function getOrganizeList(data: any, options?: any): Promise<any> {
  return request('/api/v1/organize/list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


// /api/v1/organize/create添加组织信息
export async function getOrganizeCreate(data: any, options?: any): Promise<any> {
  return request('/api/v1/organize/create', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// /api/v1/organize/update组织信息修改
export async function getOrganizeUpdate(data: any, options?: any): Promise<any> {
  return request('/api/v1/organize/update', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

///api/v1/user/fileUpload /api/v1/user/fileUpload
export async function fileUpload(params: any, options?: any): Promise<any> {
  // return request('/api/v1/user/fileUpload', {
  //   method: 'POST',
  //   data,
  //   ...(options || {}),
  // });
  return await umiRequest('/api/v1/user/fileUpload', {
    method: 'POST',
    headers: { 'Content-Type': 'multipart/form-data' },
    data: params,
    requestType: 'form'  //加个这个，就可以了
  })
}


// 患者列表
export async function reqRegisterList(data: any, options?: any): Promise<any> {
  return request('/api/v1/patient/list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


// 推荐人员列表
export async function reqRecommendList(data: any, options?: any): Promise<any> {
  return request('/api/v1/user/recommendList', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 推荐人员列表
export async function reqGroupList(data: any, options?: any): Promise<any> {
  return request('/api/v1/group/list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


// 获取所有医生信息
export async function reqDoctorList(data: any, options?: any): Promise<any> {
  return request('/api/v1/user/doctorList', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// 获取医生排班信息
export async function reqSchedulingByDoctor(data: any, options?: any): Promise<any> {
  return request('/api/v1/scheduling/schedulingByDoctor', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


// /api/v1/order/list订单列表
export async function reqRrderList(data: any, options?: any): Promise<any> {
  return request('/api/v1/order/list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}
// /api/v1/order/create提交订单信息
export async function reqRrderCreate(data: any, options?: any): Promise<any> {
  return request('/api/v1/order/create', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// /api/v1/order/update订单信息修改
export async function reqRrderUpdate(data: any, options?: any): Promise<any> {
  return request('/api/v1/order/update', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


// /api/v1/order/get/{id}订单信息详情
export async function reqRrderDetail(data: any, options?: any): Promise<any> {
  return request(`/api/v1/order/get/${data?.id}`, {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// /api/v1/order/get/order/detail/{id}
export async function reqOrderDetail(data: any, options?: any): Promise<any> {
  return request(`/api/v1/order/get/order/detail/${data?.id}`, {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

// /api/v1/order/get/order/allDetail/{id}
export async function reqAllDetail(data: any, options?: any): Promise<any> {
  return request(`/api/v1/order/get/order/allDetail/${data?.id}`, {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

export async function reqAllDetailWithType(data: any, type:number, options?: any): Promise<any> {
  return request(`/api/v1/order/get/order/allDetail/${data?.id}?type=${type}`, {
    method: 'POST',
    data,
    ...(options || {}),
  });
}


